#include <stdio.h>
#include <stdlib.h>
#define MaxSize 100
struct SNode {
    char Data[MaxSize];
    int Top;
};
typedef struct SNode *Stack;
Stack CreateStack(){
	Stack S;
	S=(Stack)malloc(sizeof(struct SNode));
	S->Top=-1;
	return S;
}
void push(Stack S,char x){
	if(S->Top==MaxSize){
		printf("Stack Full\n");
	}else{
		S->Data[++S->Top]=x;
	}
}
int prit(Stack S,char x){
	if(S->Data[S->Top]=='(')return 1;
	else
	{
	if(x=='+'||x=='-'&&(S->Data[S->Top]=='*'||(S->Data[S->Top]=='/')))
		return 0;
	else if(x=='*'||x=='/'&&(S->Data[S->Top]=='+'||(S->Data[S->Top]=='-')))
		return 1;
	else if(x=='+'||x=='-'&&(S->Data[S->Top]=='+'||S->Data[S->Top]=='-'))
		return 0;
	else if(x=='*'||x=='/'&&(S->Data[S->Top]=='*'||S->Data[S->Top]=='/'))
		return 0;
	}
}
char pop(Stack S){
	if(S->Top==-1){
		printf("Stack is Empty!\n");
	}else{
		char t;
		t=S->Data[S->Top];
		S->Top--;
		return t;
	}
}
int main(){
	char ch,a[MaxSize],t;
	Stack S;
	S=CreateStack();
	scanf("%[^\n]",a);
	getchar();
	/*吸收\n */
	int f=0,first=1,i=0;
	while(a[i]!='\0'){
		if(!i){
			if(a[i]>='0'&&a[i]<='9'||a[i]=='-')
			{
				printf("%c",a[i++]);
				while(a[i]>='0'&&a[i]<='9'||a[i]=='.')
				printf("%c",a[i++]);
			}
			else if(a[i]=='+')
			{
				i++;
				while(a[i]>='0'&&a[i]<='9'||a[i]=='.')
				printf("%c",a[i++]);
			}
			else{ 
				push(S,a[i++]);f=1;
			}
		}
		else{
			if(a[i]>='0'&&a[i]<='9'||a[i]=='.'){
			if(!f){
				printf(" %c",a[i++]);
			}else{
				printf("%c",a[i++]);f=0;
			}
			while(a[i]>='0'&&a[i]<='9'||a[i]=='.')
			{
				printf("%c",a[i++]);
			}
		}else{
		/*处理符号*/ 
		if(S->Top==-1)push(S,a[i++]);
		else{
			switch(a[i]){
			case '(':push(S,a[i++]);break;
			case ')':{
				while(1){
					if((t=pop(S))=='('){ 
					break;
					}
					printf(" %c",t);
				}
				i++;	
				break;
			}
			case '+':{
				if(a[i-1]=='('){
					i++;first=1;
					while(a[i]>='0'&&a[i]<='9'||a[i]=='.')
					{
					if(first){
						printf(" %c",a[i++]);first=0;
					}else{
						printf("%c",a[i++]);	
					}
					}	
					break;
				}else{
				if(prit(S,a[i])){
					push(S,a[i++]);
				}else{
					while(!prit(S,a[i])){
						if(S->Top==-1)break;
						printf(" %c",pop(S));
						if(S->Top==-1)break;
					}
					push(S,a[i++]);
				}
				break;
				}
			}
			case '-':{
				if(a[i-1]=='('){
					printf(" %c",a[i++]);
					while(a[i]>='0'&&a[i]<='9'||a[i]=='.')
					printf("%c",a[i++]);
					break;
				}else{
					if(prit(S,a[i])){
					push(S,a[i++]);
				}else{
					while(!prit(S,a[i])){
						if(S->Top==-1)break;
						printf(" %c",pop(S));
						if(S->Top==-1)break;
					}
					push(S,a[i++]);
				}
				break;
				}
			}
			case '*':
			case '/':{
				if(prit(S,a[i])){
					push(S,a[i++]);
				}else{
					while(!prit(S,a[i])){
						if(S->Top==-1)break;
						printf(" %c",pop(S));
						if(S->Top==-1)break;
					}
					push(S,a[i++]);
				}
				break;
			}
		}
		}
		} 
		}
	}
	while(S->Top!=-1){
		printf(" %c",pop(S));
	}
	printf("\n");
	return 0;
}
//表达式转换 